import request from '@/utils/request'
import {
  departmentMemberInformation,
  ResponseData,
  departmentMemberInformationResponseData,
  selectMember,
  deleteMemberList,
} from './type'
enum API {
  // 获取已有部门成员信息
  DEPARTMENTDATA_URL = 'department/getDepartmentMemberData/',
  // 添加部门成员
  ADDDEPARTMENTDATA_URL = 'departmentMember/addDepartmentMember/',
  // // 修改部门成员
  // UPDATEDEPARTMENTDATA_URL='department/updateDepartment/',
  // 删除部门成员
  DELETEDEPARTMENTDATA_URL = 'departmentMember/deleteDepartmentMember',
}

// 获取已有部门成员信息
export const reqdepartmentMembersData = (params: selectMember) =>
  request.get<any, departmentMemberInformationResponseData>(
    API.DEPARTMENTDATA_URL,
    { params: params },
  )

// 添加部门成员
export const reqAddOrUpdatedepartmentMemberData = (
  data: departmentMemberInformation,
) => {
  return request.post<any, ResponseData>(API.ADDDEPARTMENTDATA_URL, data)
}

// 删除部门成员
export const reqDeletedepartmentMemberData = (idList: number[]) =>
  request.delete<any, ResponseData>(API.DELETEDEPARTMENTDATA_URL, {
    data: idList,
  })
